package com.cbd.pojo;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.validation.annotation.Validated;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 企业车位
 * 
 */
@Entity
@Table(name="companycarport")
@Validated
public class Companycarport implements Serializable{
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="carportID")
	private int carportID;
	/**
	* 车位地址
	*/
	@Column(name="carportAddress")
	@NotEmpty(message="不能为空")
	@Length(max=30,min=3,message="长度必须为3-30位之间")
	private String carportAddress;
	/**
	 * 车位编号
	 */
	@Column(name="carportNO")
	@NotEmpty(message="不能为空")
	@Length(max=15,min=3,message="长度必须为3-15位之间")
	private String carportNO;
	/**
	 * 空闲状态 0：空闲 1：已被租用
	 * 
	 */
	@Column(name="type")
	private boolean type;
	
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="pactID")
	@JsonBackReference
	private Cbdpact cbdpact;
	
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="comPactID")
	@JsonBackReference
	private Companypact companyPact;
	
	public int getCarportID() {
		return carportID;
	}

	public void setCarportID(int carportID) {
		this.carportID = carportID;
	}

	public String getCarportAddress() {
		return carportAddress;
	}

	public void setCarportAddress(String carportAddress) {
		this.carportAddress = carportAddress;
	}

	public String getCarportNO() {
		return carportNO;
	}

	public void setCarportNO(String carportNO) {
		this.carportNO = carportNO;
	}

	public boolean isType() {
		return type;
	}

	public void setType(boolean type) {
		this.type = type;
	}

	public Cbdpact getCbdpact() {
		return cbdpact;
	}

	public void setCbdpact(Cbdpact cbdpact) {
		this.cbdpact = cbdpact;
	}

	public Companypact getCompanyPact() {
		return companyPact;
	}

	public void setCompanyPact(Companypact companyPact) {
		this.companyPact = companyPact;
	}
	
}